import createAuthless from '~/api/authless.js'
import createAuth from '~/api/auth.js'
import createDomain from '~/api/domain.js'
import createResource from '~/api/resource.js'

// departments
import {
  departmentListFunc,
  areaListFunc,
  gradeListFunc,
  classListFunc,
  teacherListFunc
} from '@/utils/department'

export default (ctx, inject) => {
  // inject the repository in the context (ctx.app.$repository)
  // And in the Vue instances (this.$repository in your components)
  const AuthlessWithAxios = createAuthless(ctx.$axios)
  const AuthWithAxios = createAuth(ctx.$axios)
  const DomainWithAxios = createDomain(ctx.$axios)
  const ResourceWithAxios = createResource(ctx.$axios)
  inject('authlessApi', AuthlessWithAxios('/authless'))
  inject('authApi', AuthWithAxios('/auth'))
  inject('domainApi', DomainWithAxios('/domain'))
  inject('resourceApi', ResourceWithAxios('/resource'))
  // You can reuse the repositoryWithAxios object:
  // inject("userRepository", repositoryWithAxios('/users'));

  // get departments data
  inject('departmentListFunc', departmentListFunc)
  inject('areaListFunc', areaListFunc)
  inject('gradeListFunc', gradeListFunc)
  inject('classListFunc', classListFunc)
  inject('teacherListFunc', teacherListFunc)
}
